//
//  Spo2Model.m
//  uteped_sdk
//
//  Created by mateng on 2024/2/28.
//

#import "Spo2Model.h"

@implementation Spo2Model

- (void)from:(UTEModelMotionFrame*)data frameItem:(UTEModelMotionFrameItem*)frameItem {
    UTEModelMotionFrameItemContent *content = frameItem.content;
    self.time = [DateUtils timeToInt:frameItem.time fmt:FMT_TIME_SECS];
    self.oxygenValue = content.bloodOxygen;
    self.calendarTime = [DateUtils timeStampToString:self.time fmt:FMT_TIME_CLANDER_TIME];
    self.calendar = [DateUtils timeStampToString:self.time fmt:FMT_TIME_CLANDER];
    
    [self.storeData setObject:@(self.time) forKey:@"time"];
    [self.storeData setObject:@(self.oxygenValue) forKey:@"oxygen_value"];
    [self.storeData setObject:self.calendarTime forKey:@"calendar_time"];
    [self.storeData setObject:self.calendar forKey:@"calendar"];
}

- (BOOL)validateValue {
    return self.oxygenValue > 0;
}

@end
